<%@ page contentType="text/html;charset=utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>黑名单</title>
    <script src="js/jquery-3.1.0.min.js"></script>
    <script type="text/javascript">
		$(document).ready(function(){
			$(".del").each(function(){
				$(this).click(function(){
					var id=$(this).attr("id");
					$(this).parent().parent().remove();
					var data=id.split("_")[1];
					$.ajax({
						type:"post",
						url:"deleteBlackUser.action",
						data:{userId:data},
						success:function(msg){
							alert("删除成功！");
						}
					});
				});
				
			});
			$(".add").each(function(){
				$(this).click(function(){
					var id=$(this).attr("id");
					$(this).parent().parent().remove();
					var data=id.split("_")[1];
					$.ajax({
						type:"post",
						url:"addfriend.action",
						data:{userId:data},
						success:function(msg){
							alert("加入好友成功！！");
						}
					});
				});
				
			});
		});
    </script>
    <style type="text/css">
    	img{width:80px;heigth:100px;}
    	a{font-size:10px;text-decoration:none}
    </style>
</head>
<body>
	<table>
	 	<c:forEach items="${blackList}" var="blackUser">
	 		<div style="float:left;margin-left:50px;margin-top:10px;">
	 			<div style="width:80px;text-align: center;margin-top:10px;">${blackUser.nickName}</div>
	 			<div><img index="${blackUser.userId}" src='uImg/${blackUser.userId}.jpg'/></div>
				<div style="margin-top:10px;">
					<a href="#" class="add" id="add_${blackUser.userId}" style="float:right">加入好友</a><br/>
					<a href="#" class="del" id="del_${blackUser.userId}" style="float:right">移除黑名单</a>
				</div>
	 		</div>
	 	</c:forEach>
 	</table>
 
</body>
</html>